import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Sidebar_dlog from '../components/Sidebar_dlog.vue'
import Navs_dlog from '../components/Navs_dlog.vue'
import Header_dlog from '../components/Header_dlog.vue'
import Login from '../views/Login.vue'
import Riester from '../views/Riester.vue'
import Service from '../views/Service.vue'
import Details from '../views/Details.vue'
import Cart from '../views/Cart.vue'
import Fuwu from '../views/fuwu.vue'
import oreder from '../views/order.vue'
Vue.use(VueRouter)
mode: "hash"
// import store from '../store'
const routes = [
  // {
  //   path: '/',
  //   name: 'Home',
  //   component: Home
  // },
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/Header_dlog',
    name: 'Header_dlog',
    component: Header_dlog
  },
  {
    path: '/navs_dlog',
    name: 'Navs_dlog',
    component: Navs_dlog
  },
  {
    path: '/sidebar_dlog',
    name: 'Sidebar_dlog',
    component: Sidebar_dlog
  }, {
    path: '/login',
    name: Login,
    component: Login
  },
  {
    path: '/riester',
    name: Riester,
    component: Riester
  },
  {
    path: '/service',
    name: Service,
    component: Service
  },
  {
    path: '/details',
    name: Details,
    component: Details
  },
  {
    path: '/Cart',
    name: Cart,
    component: Cart
  }, {
    path: '/fuwu',
    name: Fuwu,
    component: Fuwu,
  }, {
    path: '/order',
    name: oreder,
    component: oreder,
  }
]

const router = new VueRouter({
  routes
})
// { to } 将要去的路由
// { from } 出发的路由
// { next } 执行下一步
// export function addMiddlewares(router, store) {
//   router.beforeEach((to, from, next) => {
//     if (!store.state.yes) {
//       next({
//         path: '/login'
//       })
//     } else {
//       next()
//     }
//   })
// }
// addMiddlewares(router, store);

export default router
